//
//  ActivityCell.m
//  LoveCar
//
//  Created by dlios on 15/5/29.
//  Copyright (c) 2015年 薛森鸿. All rights reserved.
//

#import "ActivityCell.h"
#import <Masonry/Masonry.h>

@implementation ActivityCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self createView];
    }
    return self;
}

- (void)createView
{
    self.contentView.backgroundColor = [UIColor colorWithRed:235.0/256 green:235.0/256 blue:235.0/256 alpha:1];
    
    UIView *sview = [[UIView alloc] init];
    [self.contentView addSubview:sview];
    [sview mas_makeConstraints:^(MASConstraintMaker *make) {
       make.edges.equalTo(self.contentView).with.insets(UIEdgeInsetsMake(10, 10, 10, 10));
    }];
    sview.backgroundColor = [UIColor whiteColor];
    [sview release];
    
    self.image = [[UIImageView alloc] init];
    [sview addSubview:_image];
    [_image mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(sview).with.offset(10);
        make.top.equalTo(sview).with.offset(10);
        make.right.equalTo(sview).with.offset(-10);
        make.height.with.mas_equalTo(@200);
    }];
    [_image release];
    
    self.alabel = [[UILabel alloc] init];
    [sview addSubview:_alabel];
    [_alabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(sview).with.offset(10);
        make.top.equalTo(_image.mas_bottom).with.offset(1);
        make.right.equalTo(sview).with.offset(-10);
        make.height.with.mas_equalTo(@30);
    }];
    _alabel.font = [UIFont systemFontOfSize:14];
    [_alabel release];
    
    self.blabel = [[UILabel alloc] init];
    [sview addSubview:_blabel];
    [_blabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(sview).with.offset(10);
        make.top.equalTo(_alabel.mas_bottom).with.offset(-5);
        make.width.width.mas_equalTo(@190);
        make.height.with.mas_equalTo(@30);
    }];
    _blabel.textColor = [UIColor lightGrayColor];
    _blabel.font = [UIFont systemFontOfSize:13];
    [_blabel release];
    
    self.button = [[UILabel alloc] init];
    [sview addSubview:_button];
    _button.backgroundColor = [UIColor orangeColor];
    [_button setText:@"立即参与"];
    [_button setTextColor:[UIColor whiteColor]];
    _button.font = [UIFont systemFontOfSize:14];
    _button.textAlignment = 1;
    [_button mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(_alabel.mas_bottom).with.offset(0);
        make.right.equalTo(sview).with.offset(-10);
        make.width.with.mas_equalTo(@80);
        make.height.with.mas_equalTo(@20);
    }];
    [_button release];
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];
    
    // Configure the view for the selected state
}

- (void)dealloc {
    [_button release];
    [_image release];
    [_alabel release];
    [_blabel release];
    [super dealloc];
}

@end
